UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NSqLnZw207tVzeNozAUfHhOwwTC7AowjWyIEuY34hx4=' 
WHERE 
  key_id = '35acca73f513e4b6e9831633f99af7b83da553a135b9bbc3a97f29c9a0b46764' 
  AND (
    token = 'NSqLnZw207tVzeNozAUfHhOwwTC7AowjWyIEuY34hx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034