UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LemqSayS6hsTNwxCYZP4IY/VGg7ucID40Rv/fof7OlI=' 
WHERE 
  key_id = '41bfc66f774347b864f6793b095eecd43920d758be4c27642f1dfcf132e9c56b' 
  AND (
    token = 'LemqSayS6hsTNwxCYZP4IY/VGg7ucID40Rv/fof7OlI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036