UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xer3kM4Fa7hdz/PCsR5KelMUDktk3oXj+lOf+bR2bmI=' 
WHERE 
  key_id = '9e33bacf2c45878c4bc6f9d9267700c897d3d1a16cecfad521ad6caa7d783680' 
  AND (
    token = 'xer3kM4Fa7hdz/PCsR5KelMUDktk3oXj+lOf+bR2bmI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035