UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wMERbUW/joKJxLhkfhadMF8SwF4Beya14B2TVsEA+FA=' 
WHERE 
  key_id = '2c3ff5471e838541c653376e7ce5ba8639646818f8b3a03f740bf962536a190c' 
  AND (
    token = 'wMERbUW/joKJxLhkfhadMF8SwF4Beya14B2TVsEA+FA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034