UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v9ReRWe3p2GaCZ/xUt09bZgJgayMwpEKd+UR9VrYYG4=' 
WHERE 
  key_id = '047837be2e90617417bf1ee04cd295fa462b51cc2c6a5c58b1735df62903188a' 
  AND (
    token = 'v9ReRWe3p2GaCZ/xUt09bZgJgayMwpEKd+UR9VrYYG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040