UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '59Wydz+i8mIARqlky86z8qNZimFVif3eGbrEqk3zN7c=' 
WHERE 
  key_id = 'ae9d117345b0d5423ce59b570241b2d993955d0e0cd63064f97d3dc0421ab445' 
  AND (
    token = '59Wydz+i8mIARqlky86z8qNZimFVif3eGbrEqk3zN7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048