UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ccShm8HG2PX+hoHA2j595bebyrzoSmTaUyNsTPhRvho=' 
WHERE 
  key_id = 'ba0de8a3f091206ef90e7c5d928cbd769be1fa9537d3074231e7c92fdd36ed48' 
  AND (
    token = 'ccShm8HG2PX+hoHA2j595bebyrzoSmTaUyNsTPhRvho=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027