UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B47NGTe+3P/OBDE9d5seqr44q/lg5isxU5+gcTBPtU4=' 
WHERE 
  key_id = 'f50134147d6ab298fcbb5cd7ffc3e1d09f0d6a5a7eeea9c6c5c9b16301d738cf' 
  AND (
    token = 'B47NGTe+3P/OBDE9d5seqr44q/lg5isxU5+gcTBPtU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016