UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iJwYW2sXz6waHu2LY4L4mVetK8EsDYxBfmnRZ/KDPP0=' 
WHERE 
  key_id = 'ba217a867ea377cf5c9009f878f3dc4c39d4b5c08c13d5c8adf0c04757c47fe5' 
  AND (
    token = 'iJwYW2sXz6waHu2LY4L4mVetK8EsDYxBfmnRZ/KDPP0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026