UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KPml13H40NlQtQP9kAexDOtkNxvvAmOG2SjJ11QZxMg=' 
WHERE 
  key_id = 'db4fc77b1d86829db3a997b1514fc9ca808536aa8382416da576202b439bbe1f' 
  AND (
    token = 'KPml13H40NlQtQP9kAexDOtkNxvvAmOG2SjJ11QZxMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040