UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f5fxc9BhjSxWxMpd7u8qhrnrVSrobZh5Rn/eT5b4fjg=' 
WHERE 
  key_id = '071b728eba3e12636016ca452795835f12e3d7cc9d7647a04781b676328b055a' 
  AND (
    token = 'f5fxc9BhjSxWxMpd7u8qhrnrVSrobZh5Rn/eT5b4fjg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042