UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BbqNOkABij33f4b9jGn/qgNtJFQFvL78J82yfauucmE=' 
WHERE 
  key_id = '7f78148f1d0cf0981afbac8aca908f5fc8e7f9f547f7aeb134343945ef1ea533' 
  AND (
    token = 'BbqNOkABij33f4b9jGn/qgNtJFQFvL78J82yfauucmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054