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

Query time 0.00031