UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H6FD2NOvZA+dHYtF241qCKiahx31agsFnLDsM3+7RhI=' 
WHERE 
  key_id = 'e8562e9c2de2a01c8f5d2ed6f02aa20d05ecde5afa4e01f15f4239707c7af1fa' 
  AND (
    token = 'H6FD2NOvZA+dHYtF241qCKiahx31agsFnLDsM3+7RhI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024