UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B5XiX69yorxv8GWFU368myiOmsTzflC3d7s5Pgz65fk=' 
WHERE 
  key_id = '8339bc1f631f77cd5fe5835e93246af5258f5ea7f6f59bff242758902ea7e7ff' 
  AND (
    token = 'B5XiX69yorxv8GWFU368myiOmsTzflC3d7s5Pgz65fk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027