UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zZO6zaadGADmqUJpao7a/u5YHanUs1xThnyeDy5ZB2Q=' 
WHERE 
  key_id = '1660f027727b3a07708505c363da308959d1e63f51bb70a6dc4280dda21258c4' 
  AND (
    token = 'zZO6zaadGADmqUJpao7a/u5YHanUs1xThnyeDy5ZB2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048