UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R2Fuj8kBLk+d7HrS8AK4X0UcUxA5/WIzzEC05xpISHQ=' 
WHERE 
  key_id = '470510d56e79f7abee04612a01b4d5dd11e45ae3e9ecdd4cef2b7b2e85454891' 
  AND (
    token = 'R2Fuj8kBLk+d7HrS8AK4X0UcUxA5/WIzzEC05xpISHQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031