UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XZw+2SAUv0yYWa521I2caGB9WPUz98lEn5mwsWtCJRE=' 
WHERE 
  key_id = '5ae16116914953f8e2bae88df2a34e9d20382a2b9992e4720784387b2f115d0b' 
  AND (
    token = 'XZw+2SAUv0yYWa521I2caGB9WPUz98lEn5mwsWtCJRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056