UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9t7Z0vgHu4Fd1oIH822pgv8tMPc1OweOoTmjR7lYXEU=' 
WHERE 
  key_id = '145d406d74d88029388f403fa71ea400067b9f13f8f6a36d3c5ccc8f6b679652' 
  AND (
    token = '9t7Z0vgHu4Fd1oIH822pgv8tMPc1OweOoTmjR7lYXEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028