UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N519lhrikNkQx9a3Me4RWJs5pinU7IxJ2F+626ioBZw=' 
WHERE 
  key_id = '2e95a15d9261c8e4038487ea56346b1e9918f347acd6ade772710282756568bc' 
  AND (
    token = 'N519lhrikNkQx9a3Me4RWJs5pinU7IxJ2F+626ioBZw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019