UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'REnC0VT82Zv8IB410FL3Ua5b6+POEndBmT5AvjPFNik=' 
WHERE 
  key_id = '237d58874d0282b7874330ea25d749908577ab4e5c93842fccb1c37cc6c04564' 
  AND (
    token = 'REnC0VT82Zv8IB410FL3Ua5b6+POEndBmT5AvjPFNik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020