UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm9xvT+osidF4rK7Br/QThrYttcgFgAIHuuS0VVg97jw=' 
WHERE 
  key_id = '4074d760c27097e93f6511249eb84fa1c63b1ba5fe11f1b595d43aaa25c15029' 
  AND (
    token = 'm9xvT+osidF4rK7Br/QThrYttcgFgAIHuuS0VVg97jw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046