UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Was09u7v0hswlqQZXkHdEs8e+C65XSvLo9H11WRboa0=' 
WHERE 
  key_id = 'c18c61271e3f94ebeee05687a555730fe6490f64afc95829ea270105e4801e9c' 
  AND (
    token = 'Was09u7v0hswlqQZXkHdEs8e+C65XSvLo9H11WRboa0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054