UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pLE3zBEzkA4/oUUVnh1bShCNA8vWUZrusXwVDIVE+c8=' 
WHERE 
  key_id = '898a5086e8d4cc96e884fdd50d5b430c126f5e613afe7a464f50a7444e070604' 
  AND (
    token = 'pLE3zBEzkA4/oUUVnh1bShCNA8vWUZrusXwVDIVE+c8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020