UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ff7ws4COo4zK1ox/x3rRsynQTTcagUS9NatFQzDl+as=' 
WHERE 
  key_id = '7fa3849f0d27df9f19a280676834cb6952112705ccf07851c9fbd1d8db5a5327' 
  AND (
    token = 'Ff7ws4COo4zK1ox/x3rRsynQTTcagUS9NatFQzDl+as=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033