UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sPKQoONa4nJydFbWYlAoqymGMPX5IGRpHUljIuapxN0=' 
WHERE 
  key_id = 'eec1bda55b40c6ecf79f94843540169a0ab5ca620f7528cb4144d4531047b69e' 
  AND (
    token = 'sPKQoONa4nJydFbWYlAoqymGMPX5IGRpHUljIuapxN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027