UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FFWhrKDAJTA4t7ARgGyVKHQpUXhGRhWnbhllBihMmIE=' 
WHERE 
  key_id = 'c10021c452384df088e0e20c7ba906a674cde457fb31f7f2f0a87009c6cce05f' 
  AND (
    token = 'FFWhrKDAJTA4t7ARgGyVKHQpUXhGRhWnbhllBihMmIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034