UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QSMp56eSbBsKMAmV7hXXwerCE059TdxYQaw1OAYK3dg=' 
WHERE 
  key_id = '8260610905a04e963cbc733b70459c6407deeb16e08a4a8a2ff206e5ef6b303d' 
  AND (
    token = 'QSMp56eSbBsKMAmV7hXXwerCE059TdxYQaw1OAYK3dg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040