UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mQNJ21Eauf9itwynuviV4r7AMwBsMU8c8V/yVFGGRog=' 
WHERE 
  key_id = '963361d92255919a9865c43e99f90c094b47204f52537e36dbcb27e6a3f1b21a' 
  AND (
    token = 'mQNJ21Eauf9itwynuviV4r7AMwBsMU8c8V/yVFGGRog=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040